<template>
  <div class="page-header-index-wide">
    <!--头部导航-->
    <a-row :gutter="24">
      <a-col>
        <dynamic-eoa-cms :path="module1.path" :formData="getFormData(module1)"></dynamic-eoa-cms>
      </a-col>
    </a-row>


    <!--流程中心、流程提醒-->
    <a-row :gutter="24">
      <a-col :span="16" :style="{ paddingRight:'-12px' }">
        <dynamic-eoa-cms :path="module2.path" :formData="getFormData(module2)"></dynamic-eoa-cms>
      </a-col>
      <a-col :span="8">
        <dynamic-eoa-cms :path="module3.path" :formData="getFormData(module3)"></dynamic-eoa-cms>
      </a-col>
    </a-row>
    <!--我的申请、系统公告-->
    <a-row :gutter="24">
      <a-col :span="16" :style="{ paddingRight:'-12px' }">
        <dynamic-eoa-cms :path="module4.path" :formData="getFormData(module4)"></dynamic-eoa-cms>
      </a-col>
      <a-col :span="8">
        <dynamic-eoa-cms :path="module5.path" :formData="getFormData(module5)"></dynamic-eoa-cms>
      </a-col>
    </a-row>
    <!--流程数据分析、流程类型统计-->
    <a-row :gutter="24">
      <a-col :span="16" :style="{ paddingRight:'-12px' }">
        <dynamic-eoa-cms :path="module6.path" :formData="getFormData(module6)"></dynamic-eoa-cms>
      </a-col>
      <a-col :span="8">
        <dynamic-eoa-cms :path="module7.path" :formData="getFormData(module7)"></dynamic-eoa-cms>
      </a-col>
    </a-row>
    <!--近期邮件、我的计划-->
    <a-row :gutter="24">
      <a-col :span="16" :style="{ paddingRight:'-12px' }">
        <dynamic-eoa-cms :path="module8.path" :formData="getFormData(module8)"></dynamic-eoa-cms>
      </a-col>
      <a-col :span="8">
        <dynamic-eoa-cms :path="module9.path" :formData="getFormData(module9)"></dynamic-eoa-cms>
      </a-col>
    </a-row>
  </div>

</template>

<script>
import { getSiteInfo,getUserNoticeInfo } from '@/api/api'
import ACol from 'ant-design-vue/es/grid/Col'
import infiniteScroll from 'vue-infinite-scroll'
import BarMultid from '@/components/chart/BarMultid'
import { formatDate } from '@/utils/util'
import DynamicEoaCms from '@/views/modules/eoa/cmsoa/modules/DynamicEoaCms'
import { getAction } from '@/api/manage'

export default {
  name: 'EoaCmsProcessPortal',
  directives: { infiniteScroll },
  components: {
    ACol,
    BarMultid,
    DynamicEoaCms
  },
  data () {
    return {
      code:'processPortal',
      loading: true,
      cardLoading: true,
      // TODO 为了查询CMS门户数据
      siteInfo: {},
      carouselImg: [],
      signNews: [],
      newsInfo: [],
      ruleDownInfo: {
        ruleInfo:[],
        downloadInfo:[]
      },
      // TODO 为了查询CMS门户数据
      // o2ulDNOXGwvBRndehxW14dML+i/qxuVry2u3TXIhR9CrYEbhZi7RywQnYojV/SgC/PffdTE3WKU0/u0CXtgFzw==
      userNotice: [],
      url: {
        queryPortalSite: "/eoa/cms/eoaPortalSite/queryPortal",
      },
      module1:{ },
      module2:{ },
      module3:{ },
      module4:{ },
      module5:{ },
      module6:{ },
      module7:{ },
      module8:{ },
      module9:{ },
      portalId:this.$route.query.portalId,
     }
  },
  created() {
    //通告和日程计划
    this.initNoticePlanEmailInfo();
    setTimeout(() => {
      this.loading = !this.loading
    }, 1000)
  },
  methods: {
    async initNoticePlanEmailInfo () {
      var _this=this;
      // TODO 为了查询CMS门户数据
      getSiteInfo().then((res)=>{
        if(res.success){
          _this.siteInfo=res.result;
          _this.signNews=res.result.SIGN_NEWS;
          _this.newsInfo=res.result.NEWS_INFO;
          _this.ruleDownInfo.ruleInfo=res.result.Rule;
          _this.ruleDownInfo.downloadInfo=res.result.DOWNLOAD;
          if(res.result.site[0].carouselImg){
            _this.carouselImg=res.result.site[0].carouselImg.split(",");
          }
        }
      })
      // TODO 为了查询CMS门户数据
      getUserNoticeInfo({pageNo:1,pageSize:5,bizSource:'isNoBpm'}).then((res)=>{
         if(res.success){
           _this.userNotice=res.result.records;
         }
      })
      var param = {};
      if(this.portalId){
        param.id = this.portalId
      }
      param.portalType = this.code
      getAction(_this.url.queryPortalSite,param).then(res=>{
        if(res.success){
          let records = res.result.records[0].dataJson
          let tempList = JSON.parse(records);
          for(let item of tempList){
            if('module1' === item.name){
              _this.module1 = item
            }else if('module2' === item.name){
              _this.module2 = item
            }else if('module3' === item.name){
              _this.module3 = item
            }else if('module4' === item.name){
              _this.module4 = item
            }else if('module5' === item.name){
              _this.module5 = item
            }else if('module6' === item.name){
              _this.module6 = item
            }else if('module7' === item.name){
              _this.module7 = item
            }else if('module8' === item.name){
              _this.module8 = item
            }else{
              _this.module9 = item
            }
          }
        }
      })
    },
    getFormData(module){
      return this[module.formData]
    },
  }
}
</script>

<style lang="less" scoped>
  .ant-list-item-meta-title {
   font-weight: 600;
  }
  .demo-infinite-container {
    border: 1px solid #e8e8e8;
    overflow: auto;
    /*padding: 8px 24px;*/
    overflow: auto;
    height: 95px;
  }
  .demo-loading-container {
    position: absolute;
    bottom: 40px;
    width: 100%;
    text-align: center;
  }
  .timespan{
    background: #F5F5F5;
    width: 100px;
    height: 30px;
    line-height: 30px;
    text-align: center;
  }
  .demo-infinite-container .ant-list-item {
    padding: 0px 0;
  }
  .headicon{
    display:flex;
    flex-direction: column;
    align-items: center;
    border:0
}
  .header1{
    width: 100%;
    text-align: center;
    display: flex;
    background-color: white;
    border-bottom: 1px solid #e7eaec;
    height: 42px;
    border-top: 1px solid #e7eaec;
    margin-top: 10px;
  }
 /* a{
    color: black;
    text-align: center;
    o2ulDNOXGwvBRndehxW14dML+i/qxuVry2u3TXIhR9CrYEbhZi7RywQnYojV/SgC/PffdTE3WKU0/u0CXtgFzw==
  }*/
  .full-calendar{
    margin: 0 30px 0 30px !important;
  }
  /deep/ .fc-center{
    font-size: x-small;
  }
  /deep/  .fc-button-primary {
    background-color: #1890FF !important;
    border-color: #1890FF !important;
  }
</style>
